

// freezing_test

pub fn freezing_test() {
    let mut _mutable_integer = 7i32;

    {
        // Borrow `_mutable_integer`
        let _large_integer = &_mutable_integer;
        println!(" 引起冻结（&引起冻结）的 _large_integer {:?}", _large_integer);
        println!(" 被冻结的 _mutable_integer {:?}", _mutable_integer);
        // 用的&地址，所以被冻结了

        // Error! `_mutable_integer` is frozen in this scope
        // _mutable_integer = 50;
        // 注释此句 上句因被冻结不能修改

        // `_large_integer` goes out of scope
        // _large_integer引起了_mutable_integer的冻结。被回收后 就能修改了
    }

    // Ok! `_mutable_integer` is not frozen in this scope
    _mutable_integer = 3;
    println!(" 被解除冻结的 _mutable_integer {:?}", _mutable_integer);
}